package com.bishe.demo.modules.other.dao;

import com.bishe.demo.modules.other.entity.UserMessage;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserMessageDao {
    @Insert("insert into other_user_message values(null,#{userId},#{messageId})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    void insertUserMessage(UserMessage userMessage);

    @Delete("delete from other_user_message where user_id=#{userId}")
    void deleteUserMessageByUserId(int userId);

    @Delete("delete from other_user_message where message_id=#{messageId}")
    void deleteUserMessageByMessageId(int messageId);
}
